package bairui.international.model.domain.jpa;

import com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue;

/**
 *
 * (商学院)TB_College
 *
 * @说明
 * <pre>

 * </pre>
 *
 * @see Help_TB_College#inheritance() 继承体系信息
 *
 */
@org.hibernate.annotations.DynamicInsert
@org.hibernate.annotations.DynamicUpdate

@javax.persistence.Entity(name="t_college")
@com.lianjing.sh.processing.info.annotation.GenerateInfoModel
@SuppressWarnings("serial")
@com.lianjing.sh.model.common.annotation.Comment("商学院")
@com.lianjing.sh.processing.info.annotation.InfoComment("商学院")
public class TB_College
 extends TBSuper_BaseIDAndTimeAndOrderValue
 implements 
	com.lianjing.sh.model.common.stardard.TableModel<Long>,
	com.sh_lianjing.state.HasStatable,
	java.io.Serializable

{

	
	
	/**
	 * 必须属性赋值接口
	 */
	public static interface MustProperties{
		/** 标题 */
		public String getTitle();
		/** 内容 */
		public String getContent();
		/** 商学院分类 */
		public bairui.international.model.domain.jpa.TB_CollegeCategory getCollegeCategory();
		/** 状态 */
		public com.lianjing.sh.model.uml.model.status.State_UpDown getState();
		/** 时间 */
		public java.util.Date getDate();
		/** 是否显示大图 */
		public Boolean getBigImgFlag();
	}
	
	/**
	 * 为必须属性赋值
	 */
	public TB_College properties(MustProperties properties) {
		this.setTitle(properties.getTitle());
		this.setContent(properties.getContent());
		this.setCollegeCategory(properties.getCollegeCategory());
		this.setState(properties.getState());
		this.setDate(properties.getDate());
		this.setBigImgFlag(properties.getBigImgFlag());
		return this;
	}
	
	/**
	 *	必须属性构造函数
	 */
	public TB_College(MustProperties properties) {
		this.properties(properties);
	}
	
	
	/**
	 * 可选单属性赋值接口
	 */
	public static interface OptionalSingleProperties{
		/** 摘要 */
		public String getComment();
	}
	
	/**
	 * 为可选单属性赋值
	 */
	public TB_College properties(OptionalSingleProperties properties) {
		this.setComment(properties.getComment());
		return this;
	}
	
	
	
	public TB_College(MustProperties must, OptionalSingleProperties optionalSingle) {
		this.properties(must);
		this.properties(optionalSingle);
	}
	
	/**
	 * 仅当前必须属性赋值接口
	 */
	public static interface CurrentMustProperties{
		/** 标题 */
		public String getTitle();
		/** 内容 */
		public String getContent();
		/** 商学院分类 */
		public bairui.international.model.domain.jpa.TB_CollegeCategory getCollegeCategory();
		/** 状态 */
		public com.lianjing.sh.model.uml.model.status.State_UpDown getState();
		/** 时间 */
		public java.util.Date getDate();
		/** 是否显示大图 */
		public Boolean getBigImgFlag();
	}
	
	/**
	 * 为仅当前必须属性赋值
	 */
	public TB_College properties(CurrentMustProperties properties) {
		this.setTitle(properties.getTitle());
		this.setContent(properties.getContent());
		this.setCollegeCategory(properties.getCollegeCategory());
		this.setState(properties.getState());
		this.setDate(properties.getDate());
		this.setBigImgFlag(properties.getBigImgFlag());
		return this;
	}
	
	/**
	 * 仅当前可选单属性赋值接口
	 */
	public static interface CurrentOptionalSingleProperties{
		/** 摘要 */
		public String getComment();
	}
	
	/**
	 * 为仅当前可选单属性赋值
	 */
	public TB_College properties(CurrentOptionalSingleProperties properties) {
		this.setComment(properties.getComment());
		return this;
	}
	
	public TB_College(
		@lombok.NonNull com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue bean,
		CurrentMustProperties mustProperties,
		CurrentOptionalSingleProperties optionalProperties
	) {
		this(bean);
		this.properties(mustProperties);
		this.properties(optionalProperties);
	}
	
	public TB_College(
		@lombok.NonNull com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue bean
	) {
		update(bean);
	}
	
	public TB_College update(com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue bean){
		this.setId(bean.getId());
		this.setCreateTime(bean.getCreateTime());
		this.setModifyTime(bean.getModifyTime());
		this.setOrderValue(bean.getOrderValue());
		return this;
	}
	
	
	/**
	 * 更新属性内部类
	 */
	public abstract class UpdateProperties {
	
		public UpdateProperties() throws Exception {
			Integer orderValue = getOrderValue(TB_College.this);
			if(isOverride_getOrderValue){
				TB_College.this.setOrderValue(orderValue);
			}
	
			String title = getTitle(TB_College.this);
			if(isOverride_getTitle){
				TB_College.this.setTitle(title);
			}
	
			String content = getContent(TB_College.this);
			if(isOverride_getContent){
				TB_College.this.setContent(content);
			}
	
			bairui.international.model.domain.jpa.TB_CollegeCategory collegeCategory = getCollegeCategory(TB_College.this);
			if(isOverride_getCollegeCategory){
				TB_College.this.setCollegeCategory(collegeCategory);
			}
	
			com.lianjing.sh.model.uml.model.status.State_UpDown state = getState(TB_College.this);
			if(isOverride_getState){
				TB_College.this.setState(state);
			}
	
			java.util.List<bairui.international.model.domain.jpa.TB_CollegeImage> collegeImages = getCollegeImages(TB_College.this);
			if(isOverride_getCollegeImages){
				TB_College.this.setCollegeImages(collegeImages);
			}
	
			java.util.Date date = getDate(TB_College.this);
			if(isOverride_getDate){
				TB_College.this.setDate(date);
			}
	
			Boolean bigImgFlag = getBigImgFlag(TB_College.this);
			if(isOverride_getBigImgFlag){
				TB_College.this.setBigImgFlag(bigImgFlag);
			}
	
			String comment = getComment(TB_College.this);
			if(isOverride_getComment){
				TB_College.this.setComment(comment);
			}
		}
	
		public TB_College up(){
			return TB_College.this;
		}
	
		/** 排序值 */
		private boolean isOverride_getOrderValue = true;
		public Integer getOrderValue(TB_College it) throws Exception { 
			isOverride_getOrderValue = false; 
			return null;
		}
		/** 标题 */
		private boolean isOverride_getTitle = true;
		public String getTitle(TB_College it) throws Exception { 
			isOverride_getTitle = false; 
			return null;
		}
		/** 内容 */
		private boolean isOverride_getContent = true;
		public String getContent(TB_College it) throws Exception { 
			isOverride_getContent = false; 
			return null;
		}
		/** 商学院分类 */
		private boolean isOverride_getCollegeCategory = true;
		public bairui.international.model.domain.jpa.TB_CollegeCategory getCollegeCategory(TB_College it) throws Exception { 
			isOverride_getCollegeCategory = false; 
			return null;
		}
		/** 状态 */
		private boolean isOverride_getState = true;
		public com.lianjing.sh.model.uml.model.status.State_UpDown getState(TB_College it) throws Exception { 
			isOverride_getState = false; 
			return null;
		}
		/** 商学院图片 */
		private boolean isOverride_getCollegeImages = true;
		public java.util.List<bairui.international.model.domain.jpa.TB_CollegeImage> getCollegeImages(TB_College it) throws Exception { 
			isOverride_getCollegeImages = false; 
			return null;
		}
		/** 时间 */
		private boolean isOverride_getDate = true;
		public java.util.Date getDate(TB_College it) throws Exception { 
			isOverride_getDate = false; 
			return null;
		}
		/** 是否显示大图 */
		private boolean isOverride_getBigImgFlag = true;
		public Boolean getBigImgFlag(TB_College it) throws Exception { 
			isOverride_getBigImgFlag = false; 
			return null;
		}
		/** 摘要 */
		private boolean isOverride_getComment = true;
		public String getComment(TB_College it) throws Exception { 
			isOverride_getComment = false; 
			return null;
		}
	
	}
	
	
	/**
	 * 构造函数
	 */
	public TB_College() {
	}
	
	public TB_College(
		@lombok.NonNull Long id
	) {
		this.setId(id);
	}
	
	public TB_College(
		@lombok.NonNull TB_College bean
	) {
		this.setId(bean.getId());
		this.setCreateTime(bean.getCreateTime());
		this.setModifyTime(bean.getModifyTime());
		this.setOrderValue(bean.getOrderValue());
		this.setTitle(bean.getTitle());
		this.setContent(bean.getContent());
		this.setCollegeCategory(bean.getCollegeCategory());
		this.setCreator(bean.getCreator());
		this.setLastModifier(bean.getLastModifier());
		this.setState(bean.getState());
		this.setCollegeImages(bean.getCollegeImages());
		this.setDate(bean.getDate());
		this.setBigImgFlag(bean.getBigImgFlag());
		this.setComment(bean.getComment());
	}
	
	

	


	/**
	 * 属性
	 */
	@com.lianjing.sh.model.common.annotation.Comment("标题")
	@com.lianjing.sh.processing.info.annotation.InfoComment("标题")
	@javax.persistence.Column(name="title", nullable=false, length=255)
	private String title;

	@com.lianjing.sh.model.common.annotation.Comment("内容")
	@com.lianjing.sh.processing.info.annotation.InfoComment("内容")
	@javax.persistence.Lob
	@javax.persistence.Column(name="content", nullable=false, length=20000)
	private String content;

	@com.lianjing.sh.model.common.annotation.Comment("商学院分类")
	@com.lianjing.sh.processing.info.annotation.InfoComment("商学院分类")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.ManyToOne(optional=false)
	private bairui.international.model.domain.jpa.TB_CollegeCategory collegeCategory;

	@com.lianjing.sh.model.common.annotation.Comment("创建者")
	@com.lianjing.sh.processing.info.annotation.InfoComment("创建者")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.JoinColumn(name="creator_id", nullable=false)
	@javax.persistence.ManyToOne(optional=false)
	private bairui.international.model.domain.jpa.TB_Admin creator;

	@com.lianjing.sh.model.common.annotation.Comment("最后修改者")
	@com.lianjing.sh.processing.info.annotation.InfoComment("最后修改者")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.JoinColumn(name="lastModifier_id", nullable=false)
	@javax.persistence.ManyToOne(optional=false)
	private bairui.international.model.domain.jpa.TB_Admin lastModifier;

	@com.lianjing.sh.model.common.annotation.Comment("状态")
	@com.lianjing.sh.processing.info.annotation.InfoComment("状态")
	@javax.persistence.Enumerated(javax.persistence.EnumType.STRING)
	@javax.persistence.Column(name="state", nullable=false)
	private com.lianjing.sh.model.uml.model.status.State_UpDown state;

	@com.lianjing.sh.model.common.annotation.Comment("商学院图片")
	@com.lianjing.sh.processing.info.annotation.InfoComment("商学院图片")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.OneToMany(mappedBy="college")
	private java.util.List<bairui.international.model.domain.jpa.TB_CollegeImage> collegeImages;

	@com.lianjing.sh.model.common.annotation.Comment("时间")
	@com.lianjing.sh.processing.info.annotation.InfoComment("时间")
	@javax.persistence.Column(name="date", nullable=false)
	private java.util.Date date;

	@com.lianjing.sh.model.common.annotation.Comment("是否显示大图")
	@com.lianjing.sh.processing.info.annotation.InfoComment("是否显示大图")
	@javax.persistence.Column(name="bigImgFlag", nullable=false)
	private Boolean bigImgFlag;

	@com.lianjing.sh.model.common.annotation.Comment("摘要")
	@com.lianjing.sh.processing.info.annotation.InfoComment("摘要")
	@javax.persistence.Column(name="comment", length=500)
	private String comment;

	/** get[标题] */
	public String getTitle() {
		return this.title;
	}

	/** get[内容] */
	public String getContent() {
		return this.content;
	}

	/** get[商学院分类] */
	public bairui.international.model.domain.jpa.TB_CollegeCategory getCollegeCategory() {
		return this.collegeCategory;
	}

	/** get[创建者] */
	public bairui.international.model.domain.jpa.TB_Admin getCreator() {
		return this.creator;
	}

	/** get[最后修改者] */
	public bairui.international.model.domain.jpa.TB_Admin getLastModifier() {
		return this.lastModifier;
	}

	/** get[状态] */
	public com.lianjing.sh.model.uml.model.status.State_UpDown getState() {
		return this.state;
	}

	/** get[商学院图片] */
	public java.util.List<bairui.international.model.domain.jpa.TB_CollegeImage> getCollegeImages() {
		return this.collegeImages;
	}

	/** get[时间] */
	public java.util.Date getDate() {
		return this.date;
	}

	/** get[是否显示大图] */
	public Boolean getBigImgFlag() {
		return this.bigImgFlag;
	}

	/** get[摘要] */
	public String getComment() {
		return this.comment;
	}

	/** set[标题] */
	public void setTitle(String title) {
		this.title = title;
	}

	/** set[内容] */
	public void setContent(String content) {
		this.content = content;
	}

	/** set[商学院分类] */
	public void setCollegeCategory(bairui.international.model.domain.jpa.TB_CollegeCategory collegeCategory) {
		this.collegeCategory = collegeCategory;
	}

	/** set[创建者] */
	public void setCreator(bairui.international.model.domain.jpa.TB_Admin creator) {
		this.creator = creator;
	}

	/** set[最后修改者] */
	public void setLastModifier(bairui.international.model.domain.jpa.TB_Admin lastModifier) {
		this.lastModifier = lastModifier;
	}

	/** set[状态] */
	public void setState(com.lianjing.sh.model.uml.model.status.State_UpDown state) {
		this.state = state;
	}

	/** set[商学院图片] */
	public void setCollegeImages(java.util.List<bairui.international.model.domain.jpa.TB_CollegeImage> collegeImages) {
		this.collegeImages = collegeImages;
	}

	/** set[时间] */
	public void setDate(java.util.Date date) {
		this.date = date;
	}

	/** set[是否显示大图] */
	public void setBigImgFlag(Boolean bigImgFlag) {
		this.bigImgFlag = bigImgFlag;
	}

	/** set[摘要] */
	public void setComment(String comment) {
		this.comment = comment;
	}

	public void assignCollegeCategory(bairui.international.model.domain.jpa.TB_CollegeCategory collegeCategory) {
		if(null != collegeCategory){
			collegeCategory.addColleges(this);
		}
		this.setCollegeCategory(collegeCategory);
	}
	




	/** add[CollegeImages] */
	public TB_College addCollegeImages(bairui.international.model.domain.jpa.TB_CollegeImage ... collegeImages){
		if(this.collegeImages == null){
			this.collegeImages = new java.util.ArrayList<>();
		}
		for(bairui.international.model.domain.jpa.TB_CollegeImage bean : collegeImages){
			bean.setCollege(this);
			this.collegeImages.add(bean);
		}
		return this;
	}
	
	/** remove[CollegeImages] */
	public TB_College removeCollegeImages(bairui.international.model.domain.jpa.TB_CollegeImage ... collegeImages){
		if(this.collegeImages == null){
			return this;
		}
		for(bairui.international.model.domain.jpa.TB_CollegeImage bean : collegeImages){
			bean.setCollege(null);
			this.collegeImages.remove(bean);
		}
		return this;
	}
	
	/**
	 * contains[CollegeImages]
	 *
	 * 全部输入都包含：返回 true
	 * 输入中有至少有一个不包含：返回 false
	 */
	public boolean containsCollegeImages(bairui.international.model.domain.jpa.TB_CollegeImage ... collegeImages){
		if(this.collegeImages == null || collegeImages==null || collegeImages.length<=0){
			return false;
		}
		return this.collegeImages.containsAll(java.util.Arrays.asList(collegeImages));
	}
	

	/** take[商学院分类] */
	public bairui.international.model.domain.jpa.TB_CollegeCategory takeCollegeCategory(){
		if(null == this.collegeCategory){
			this.collegeCategory = new bairui.international.model.domain.jpa.TB_CollegeCategory();
		}
		return this.collegeCategory;
	}
	
	/** take[创建者] */
	public bairui.international.model.domain.jpa.TB_Admin takeCreator(){
		if(null == this.creator){
			this.creator = new bairui.international.model.domain.jpa.TB_Admin();
		}
		return this.creator;
	}
	
	/** take[最后修改者] */
	public bairui.international.model.domain.jpa.TB_Admin takeLastModifier(){
		if(null == this.lastModifier){
			this.lastModifier = new bairui.international.model.domain.jpa.TB_Admin();
		}
		return this.lastModifier;
	}
	
	/** must[商学院分类] */
	public bairui.international.model.domain.jpa.TB_CollegeCategory mustCollegeCategory() {
		return this.collegeCategory;
	}
	
	/** must[创建者] */
	public bairui.international.model.domain.jpa.TB_Admin mustCreator() {
		return this.creator;
	}
	
	/** must[最后修改者] */
	public bairui.international.model.domain.jpa.TB_Admin mustLastModifier() {
		return this.lastModifier;
	}
	
	

	/**
	 * 复写 hashCode
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		return prime * result + ((this.getId() == null) ? 0 : this.getId().hashCode());
	}
	
	/**
	 * 复写 equals
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj){
			return true;
		}
		if (obj == null){
			return false;
		}
		if (getClass() != obj.getClass()){
			return false;
		}
		TB_College other = (TB_College) obj;
		if (this.getId() == null) {
			return false;
		} else if (!this.getId().equals(other.getId())){
			return false;
		}
		return true;
	}
	

	/**
	 * 用来覆盖toString()的输出
	 */
	@javax.persistence.Transient
	private String toString;
	
	public void setToString(String toString) {
		this.toString = toString;
	}
	
	/**
	 * 复写 toString
	 */
	@Override
	public String toString() {
		if(null != this.toString){
			return this.toString;
		}
		return super.toString();
	}	

	@javax.persistence.PrePersist
	public void prePersist() {
		com.lianjing.sh.web.security.authority.login.LoginUserInfo userInfo = com.lianjing.sh.web.security.authority.login.Util_Login.getInfo();
		Object user = null == userInfo ? null : userInfo.getUser();
		this.setCreateTime(new java.util.Date());
		this.setModifyTime(new java.util.Date());
		this.setCreator((bairui.international.model.domain.jpa.TB_Admin)user);
		this.setLastModifier((bairui.international.model.domain.jpa.TB_Admin)user);
	}
	
	@javax.persistence.PreUpdate
	public void preUpdate() {
		com.lianjing.sh.web.security.authority.login.LoginUserInfo userInfo = com.lianjing.sh.web.security.authority.login.Util_Login.getInfo();
		Object user = null == userInfo ? null : userInfo.getUser();
		this.setModifyTime(new java.util.Date());
		this.setLastModifier((bairui.international.model.domain.jpa.TB_Admin)user);
	}

	/**
	 * 状态相关
	 */
	public com.lianjing.sh.model.uml.model.status.State_UpDown state(){
		return this.getState();
	}


}
